home *** CD-ROM | disk | FTP | other *** search
/ Zoom 1 / Zoom (1995)(Active Software, Ground Zero).iso / utils / u607.dms / u607.adf / ThePlayer / Source / 610.1.G < prev    next >
Text File  |  1995-01-08  |  40KB  |  2,633 lines

  1. * The Player 6.1A for Asm-One 1.09 and later *
  2.  
  3. ;start = 6    ;Starting position
  4.  
  5. fade  = 1    ;0 = Normal, NO master volume control possible
  6.         ;1 = Use master volume (P61_Master)
  7.  
  8. jump = 1    ;0 = do NOT include position jump code (P61_SetPosition)
  9.         ;1 = Include
  10. system = 1    ;0 = killer
  11.         ;1 = friendly
  12.  
  13. CIA = 1        ;0 = CIA disabled
  14.         ;1 = CIA enabled
  15.  
  16. exec = 1    ;0 = ExecBase destroyed
  17.         ;1 = ExecBase valid
  18.  
  19. lev6 = 1    ;0 = NonLev6
  20.         ;1 = Lev6 used
  21.  
  22. opt020 = 0    ;0 = MC680x0 code
  23.         ;1 = MC68020+ or better
  24.  
  25. channels = 4    ;amount of channels to be played
  26.  
  27. use = -1    ;The Usecode
  28.  
  29.     incdir    include:
  30.     include Player61.i
  31.  
  32. *-----------------------------------------------*
  33.  
  34.     printt    ""
  35.     printt    "Options used:"
  36.     printt    "-------------"
  37.     ifd    start
  38.     printt    "Starting from position"
  39.     printv    start
  40.     endc
  41.     ifne    fade
  42.     printt    "Mastervolume on"
  43.     else
  44.     printt    "Mastervolume off"
  45.     endc
  46.     ifne    system
  47.     printt    "System friendly"
  48.     else
  49.     printt    "System killer"
  50.     endc
  51.     ifne    CIA
  52.     printt    "CIA-tempo on"
  53.     else
  54.     printt    "CIA-tempo off"
  55.     endc
  56.     ifne    exec
  57.     printt    "ExecBase valid"
  58.     else
  59.     printt    "ExecBase invalid"
  60.     endc
  61.     ifne    lev6
  62.     printt    "Level 6 IRQ on"
  63.     else
  64.     printt    "Non-lev6 NOT IMPLEMENTED!"
  65.     if2
  66.     fail
  67.     endc
  68.     endc
  69.     ifne    opt020
  70.     printt    "MC68020 optimizations"
  71.     else
  72.     printt    "Normal MC68000 code"
  73.     endc
  74.     printt    "Channels:"
  75.     printv    channels
  76.     ifgt    channels-4
  77.     printt    "NO MORE THAN 4 CHANNELS!"
  78.     if2
  79.     fail
  80.     endc
  81.     endc
  82.     ifeq    channels
  83.     printt    "MUST HAVE AT LEAST 1 CHANNEL!"
  84.     if2
  85.     fail
  86.     endc
  87.     endc
  88.     printt    "UseCode:"
  89.     printv    use
  90.  
  91. *-----------------------------------------------*
  92.  
  93.  
  94.     section    Player6.1A,code
  95.  
  96.     movem.l    d0-a6,-(sp)
  97.     lea    $dff000,a6
  98.     ifeq    system
  99.     move    $1c(a6),-(sp)
  100.     move    #$7fff,$9a(a6)
  101.     move    2(a6),-(sp)
  102.     move    #$7ff,$96(a6)
  103.     endc
  104.  
  105.     lea    P61_data,a0    ;Module
  106.     lea    $40000,a0
  107.     sub.l    a1,a1        ;Samples
  108.     lea    samples,a2    ;Sample buffer
  109.     moveq    #0,d0        ;Auto Detect
  110.     bsr    P61_motuuli+P61_InitOffset
  111.  
  112.     tst    d0        ;Went ok?
  113.     bne    P61_exit
  114.  
  115. P61_sync
  116.     ifeq    CIA
  117.     move.l    4(a6),d0
  118.     andi.l    #$1ff00,d0
  119.     cmp.l    #$8100,d0
  120.     bne.b    P61_sync
  121.  
  122. P61_sync2
  123.     move.l    4(a6),d0
  124.     andi.l    #$1ff00,d0
  125.     cmp.l    #$8200,d0
  126.     bne.b    P61_sync2
  127.  
  128.     move    #$fff,$180(a6)
  129.     bsr    P61_motuuli+P61_MusicOffset
  130.     clr    $180(a6)
  131.  
  132.     moveq    #0,d0
  133.     move    6(a6),d0
  134.     sub.l    #$8200,d0
  135.     cmp.l    P61_raster(pc),d0
  136.     ble.b    P61_kosj
  137.     move    d0,P61_raster+2
  138. P61_kosj
  139.     tst    P61_raster2+2
  140.     bne.b    P61_doing
  141.     move    d0,P61_raster2+2
  142.     bra.b    P61_doneg
  143. P61_doing
  144.     add.l    P61_raster2(pc),d0
  145.     asr.l    #1,d0
  146.     move.l    d0,P61_raster2
  147. P61_doneg
  148.     addq.l    #1,P61_frames
  149.  
  150.     ifne    fade
  151.     btst    #10,$16(a6)
  152.     bne.b    P61_jid
  153.     move    P61_diri(pc),d0
  154.     sub    d0,P61_motuuli+P61_MasterVolume
  155.     bne.b    P61_judo
  156.     neg    P61_diri
  157.     bra.b    P61_jid
  158. P61_judo
  159.     cmp    #64,P61_motuuli+P61_MasterVolume
  160.     bne.b    P61_jid
  161.     neg    P61_diri
  162.     endc
  163.  
  164. P61_jid
  165.     endc
  166.  
  167.     btst    #6,$bfe001
  168.     bne    P61_sync
  169.  
  170. P61_exit
  171.     bsr    P61_motuuli+P61_EndOffset
  172.  
  173.     ifeq    system
  174.     move    (sp)+,d7
  175.     bset    #15,d7
  176.     move    #$7ff,$96(a6)
  177.     move    d7,$96(a6)
  178.  
  179.     move    (sp)+,d7
  180.     bset    #15,d7
  181.     move    #$7fff,$9a(a6)
  182.     move    d7,$9a(a6)
  183.     endc
  184.     movem.l    (sp)+,d0-a6
  185.  
  186.     move.l    P61_raster(pc),d0
  187.     move.l    P61_raster2(pc),d1
  188.     move.l    P61_frames(pc),d2
  189.     move.l    P61_positionbase(pc),a0
  190.     move.l    P61_patternbase(pc),a1
  191.     move.l    P61_spos(pc),a2
  192.     rts
  193.  
  194. P61_IRQsave    dc    0
  195. P61_DMAsave    dc    0
  196. P61_raster    dc.l    0
  197. P61_raster2    dc.l    0
  198. P61_frames    dc.l    0
  199. P61_diri    dc    1
  200.  
  201. *********************************
  202. *        Player 6.1A ®        *
  203. *      All in one-version    *
  204. *        Version 610.1        *
  205. *   © 1992-95 Jarno Paananen    *
  206. *     All rights reserved    *
  207. *********************************
  208.  
  209.  
  210. ******** START OF BINARY FILE **************
  211.  
  212. P61_motuuli
  213.     bra    P61_Init
  214.     ifeq    CIA
  215.     bra    P61_Music
  216.     else
  217.     rts
  218.     rts
  219.     endc
  220.     bra    P61_End
  221.     rts                ;no P61_SetRepeat
  222.     rts
  223.     bra    P61_SetPosition
  224.  
  225. P61_Master    dc    64        ;Master volume (0-64)
  226. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  227. P61_Play    dc    1        ;Stop flag (0=stop)
  228. P61_E8        dc    0        ;Info nybble after command E8
  229. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  230.                     ;put VBR here! (Otherwise 0 assumed)
  231.                     ;You can also get VBR from here, if
  232.                     ;using exec-valid version
  233.  
  234. P61_Pos        dc    0        ;Current song position
  235. P61_Patt    dc    0        ;Current pattern
  236. P61_CRow    dc    0        ;Current pattern row
  237.  
  238. P61_Temp0Offset
  239.     dc.l    P61_temp0-P61_motuuli
  240. P61_Temp1Offset
  241.     dc.l    P61_temp1-P61_motuuli
  242. P61_Temp2Offset
  243.     dc.l    P61_temp2-P61_motuuli
  244. P61_Temp3Offset
  245.     dc.l    P61_temp3-P61_motuuli
  246.  
  247. P61_getnote    macro
  248.     moveq    #$7e,d0
  249.     and.b    (a5),d0
  250.     beq.b    .nonote
  251.     ifne    P61_vib
  252.     clr.b    P61_VibPos(a5)
  253.     endc
  254.     ifne    P61_tre
  255.     clr.b    P61_TrePos(a5)
  256.     endc
  257.  
  258.     ifne    P61_ft
  259.     add    P61_Fine(a5),d0
  260.     endc
  261.     move    d0,P61_Note(a5)
  262.     move    (a2,d0),P61_Period(a5)
  263.  
  264. .nonote
  265.     endm
  266.  
  267.     ifeq    system
  268.     ifne    CIA
  269. P61_intti
  270.     movem.l    d0-a6,-(sp)
  271.     tst.b    $bfdd00
  272.     lea    $dff000,a6
  273.     move    #$2000,$9c(a6)
  274.     move    #$fff,$180(a6)
  275.     bsr    P61_Music
  276.     move    #0,$180(a6)
  277.     movem.l    (sp)+,d0-a6
  278.     nop
  279.     rte
  280.     endc
  281.     endc
  282.  
  283.     ifne    system
  284. P61_lev6server
  285.     movem.l    d2-d7/a2-a6,-(sp)
  286.     lea    $dff000,a6
  287.  
  288.     move    P61_server(pc),d0
  289.     beq.b    P61_musica
  290.     subq    #1,d0
  291.     beq    P61_dmason
  292.     bra    P61_setrepeat
  293.  
  294. P61_musica
  295.     bsr    P61_Music
  296.  
  297. P61_ohi    movem.l    (sp)+,d2-d7/a2-a6
  298.     moveq    #1,d0
  299.     rts
  300.     endc
  301.  
  302. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  303. ;­ Call P61_Init to initialize the playroutine    ­
  304. ;­ D0 --> Timer detection (for CIA-version)    ­
  305. ;­ A0 --> Address to the module            ­
  306. ;­ A1 --> Address to samples/0            ­
  307. ;­ A2 --> Address to sample buffer        ­
  308. ;­ D0 <-- 0 if succeeded            ­
  309. ;­ A6 <-- $DFF000                ­
  310. ;­         Uses D0-A6            ­
  311. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  312.  
  313. P61_Init
  314.     cmp.l    #"P61A",(a0)+
  315.     beq.b    .modok
  316.     subq.l    #4,a0
  317.  
  318. .modok    basereg    P61_cn,a3
  319.  
  320.     ifne    CIA
  321.     move    d0,-(sp)
  322.     endc
  323.  
  324.     moveq    #0,d0
  325.     cmp.l    d0,a1
  326.     bne.b    .redirect
  327.  
  328.     move    (a0),d0
  329.     lea    (a0,d0.l),a1
  330. .redirect
  331.     move.l    a2,a6
  332.     lea    8(a0),a2
  333.     moveq    #$40,d0
  334.     and.b    3(a0),d0
  335.     bne.b    .buffer
  336.     move.l    a1,a6
  337.     subq.l    #4,a2
  338. .buffer
  339.  
  340.     lea    P61_cn(pc),a3
  341.     moveq    #$1f,d1
  342.     and.b    3(a0),d1
  343.     move.l    a0,-(sp)
  344.     lea    P61_Samples(pc),a4
  345.     subq    #1,d1
  346.     moveq    #0,d4
  347. P61_lopos
  348.     move.l    a6,(a4)+
  349.     move    (a2)+,d4
  350.     bpl.b    P61_kook
  351.     neg    d4
  352.     lea    P61_Samples-16(pc),a5
  353.     ifeq    opt020
  354.     asl    #4,d4
  355.     move.l    (a5,d4),d6
  356.     else
  357.     add    d4,d4
  358.     move.l    (a5,d4*8),d6
  359.     endc
  360.     move.l    d6,-4(a4)
  361.     move    4(a5,d4),d4
  362.     sub.l    d4,a6
  363.     sub.l    d4,a6
  364.     bra.b    P61_jatk
  365.  
  366. P61_kook
  367.     move.l    a6,d6
  368.     tst.b    3(a0)
  369.     bpl.b    P61_jatk
  370.  
  371.     tst.b    (a2)
  372.     bmi.b    P61_jatk
  373.  
  374.     move    d4,d0
  375.     subq    #2,d0
  376.     bmi.b    P61_jatk
  377.  
  378.     move.l    a1,a5
  379.     move.b    (a5)+,d2
  380.     sub.b    (a5),d2
  381.     move.b    d2,(a5)+
  382. .loop    sub.b    (a5),d2
  383.     move.b    d2,(a5)+
  384.     sub.b    (a5),d2
  385.     move.b    d2,(a5)+
  386.     dbf    d0,.loop
  387.  
  388. P61_jatk
  389.     move    d4,(a4)+
  390.     moveq    #0,d2
  391.     move.b    (a2)+,d2
  392.     moveq    #0,d3
  393.     move.b    (a2)+,d3
  394.  
  395.     moveq    #0,d0
  396.     move    (a2)+,d0
  397.     bmi.b    .norepeat
  398.  
  399.     move    d4,d5
  400.     sub    d0,d5
  401.     move.l    d6,a5
  402.  
  403.     add.l    d0,a5
  404.     add.l    d0,a5
  405.  
  406.     move.l    a5,(a4)+
  407.     move    d5,(a4)+
  408.     bra.b    P61_gene
  409. .norepeat
  410.     move.l    d6,(a4)+
  411.     move    #1,(a4)+
  412. P61_gene
  413.     move    d3,(a4)+
  414.     moveq    #$f,d0
  415.     and    d2,d0
  416.     mulu    #74,d0
  417.     move    d0,(a4)+
  418.  
  419.     tst    -6(a2)
  420.     bmi.b    .nobuffer
  421.  
  422.     moveq    #$40,d0
  423.     and.b    3(a0),d0
  424.     beq.b    .nobuffer
  425.  
  426.     move    d4,d7
  427.     tst.b    d2
  428.     bpl.b    .copy
  429.  
  430.     subq    #1,d7
  431.     moveq    #0,d5
  432.     moveq    #0,d4
  433. .lo    move.b    (a1)+,d4
  434.     moveq    #$f,d3
  435.     and    d4,d3
  436.     lsr    #4,d4
  437.  
  438.     sub.b    .table(pc,d4),d5
  439.     move.b    d5,(a6)+
  440.     sub.b    .table(pc,d3),d5
  441.     move.b    d5,(a6)+
  442.     dbf    d7,.lo
  443.     bra.b    .kop
  444.  
  445. .copy    add    d7,d7
  446.     subq    #1,d7
  447. .cob    move.b    (a1)+,(a6)+
  448.     dbf    d7,.cob
  449.     bra.b    .kop
  450.  
  451. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  452.  
  453. .nobuffer
  454.     move.l    d4,d6
  455.     add.l    d6,d6
  456.     add.l    d6,a6
  457.     add.l    d6,a1
  458. .kop    dbf    d1,P61_lopos
  459.  
  460.     move.l    (sp)+,a0
  461.     and.b    #$7f,3(a0)
  462.  
  463.     move.l    a2,-(sp)
  464.  
  465.     lea    P61_temp0(pc),a1
  466.     lea    P61_temp1(pc),a2
  467.     lea    P61_temp2(pc),a4
  468.     lea    P61_temp3(pc),a5
  469.     moveq    #Channel_Block_SIZE/2-2,d0
  470.  
  471.     moveq    #0,d1
  472. .cl    move    d1,(a1)+
  473.     move    d1,(a2)+
  474.     move    d1,(a4)+
  475.     move    d1,(a5)+
  476.     dbf    d0,.cl
  477.  
  478.     move.l    (sp)+,a2
  479.     move.l    a2,P61_positionbase(a3)
  480.  
  481.     moveq    #$7f,d1
  482.     and.b    2(a0),d1
  483.  
  484.     ifeq    opt020
  485.     lsl    #3,d1
  486.     lea    (a2,d1.l),a4
  487.     else
  488.     lea    (a2,d1.l*8),a4
  489.     endc
  490.     move.l    a4,P61_possibase(a3)
  491.  
  492.     move.l    a4,a1
  493.     moveq    #-1,d0
  494. .search    cmp.b    (a1)+,d0
  495.     bne.b    .search
  496.     move.l    a1,P61_patternbase(a3)    
  497.     move.l    a1,d0
  498.     sub.l    a4,d0
  499.     move    d0,P61_slen(a3)
  500.  
  501.     ifd    start
  502.     lea    start(a4),a4
  503.     endc
  504.  
  505.     moveq    #0,d0
  506.     move.b    (a4)+,d0
  507.     move.l    a4,P61_spos(a3)
  508.     lsl    #3,d0
  509.     add.l    d0,a2
  510.  
  511.     move.l    a1,a4
  512.     moveq    #0,d0    
  513.     move    (a2)+,d0
  514.     lea    (a4,d0.l),a1
  515.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  516.     move    (a2)+,d0
  517.     lea    (a4,d0.l),a1
  518.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  519.     move    (a2)+,d0
  520.     lea    (a4,d0.l),a1
  521.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  522.     move    (a2)+,d0
  523.     lea    (a4,d0.l),a1
  524.     move.l    a1,P61_ChaPos+P61_temp3(a3)
  525.  
  526.     lea    P61_setrepeat(pc),a0
  527.     move.l    a0,P61_intaddr(a3)
  528.  
  529.     move    #63,P61_rowpos(a3)
  530.     move    #6,P61_speed(a3)
  531.     move    #5,P61_speed2(a3)
  532.     clr    P61_speedis1(a3)
  533.  
  534.     ifne    P61_pl
  535.     clr.l    P61_plcount(a3)
  536.     endc
  537.  
  538.     ifne    P61_pde
  539.     clr    P61_pdelay(a3)
  540.     clr    P61_pdflag(a3)
  541.     endc
  542.     clr    (a3)
  543.  
  544.     moveq    #2,d0
  545.     and.b    $bfe001,d0
  546.     move.b    d0,P61_ofilter(a3)
  547.     bset    #1,$bfe001
  548.  
  549.     ifeq    system
  550.     ifne    exec
  551.     move.l    4.w,a6
  552.     moveq    #0,d0
  553.     btst    d0,297(a6)
  554.     beq.b    .no68010
  555.  
  556.     lea    P61_liko(pc),a5
  557.     jsr    -$1e(a6)
  558.  
  559. .no68010
  560.     move.l    d0,P61_VBR(a3)
  561.     endc
  562.  
  563.     move.l    P61_VBR(a3),a0
  564.     lea    $78(a0),a0
  565.     move.l    a0,P61_vektori(a3)
  566.  
  567.     move.l    (a0),P61_oldlev6(a3)
  568.     lea    P61_dmason(pc),a1
  569.     move.l    a1,(a0)
  570.     endc
  571.  
  572.     moveq    #0,d0
  573.     lea    $dff000,a6
  574.     move    d0,$a8(a6)
  575.     move    d0,$b8(a6)
  576.     move    d0,$c8(a6)
  577.     move    d0,$d8(a6)
  578.     move    #$f,$96(a6)
  579.  
  580.     ifeq    system
  581.     lea    P61_dmason(pc),a1
  582.     move.l    a1,(a0)
  583.     move    #$2000,$9a(a6)
  584.     lea    $bfd000,a0
  585.     lea    P61_Timers(pc),a1
  586.     move.b    #$7f,$d00(a0)
  587.     move.b    #$10,$e00(a0)
  588.     move.b    #$10,$f00(a0)
  589.     move.b    $400(a0),(a1)+
  590.     move.b    $500(a0),(a1)+
  591.     move.b    $600(a0),(a1)+
  592.     move.b    $700(a0),(a1)
  593.     endc
  594.  
  595.     ifeq    system!CIA
  596.     move.b    #$82,$d00(a0)
  597.     endc
  598.  
  599.     ifne    CIA
  600.     move    (sp)+,d0
  601.     subq    #1,d0
  602.     beq.b    P61_ForcePAL
  603.     subq    #1,d0
  604.     beq.b    P61_NTSC
  605.     ifne    exec
  606.     move.l    4.w,a1
  607.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  608.     beq.b    P61_NTSC
  609.     endc
  610. P61_ForcePAL
  611.     move.l    #1773447,d0    ;PAL
  612.     bra.b    P61_setcia
  613. P61_NTSC
  614.     move.l    #1789773,d0    ;NTSC
  615. P61_setcia
  616.     move.l    d0,P61_timer(a3)
  617.     divu    #125,d0
  618.     move    d0,P61_thi2(a3)
  619.     sub    #$1f0*2,d0
  620.     move    d0,P61_thi(a3)
  621.  
  622.     ifeq    system
  623.     move    P61_thi2(a3),d0
  624.     move.b    d0,$400(a0)
  625.     lsr    #8,d0
  626.     move.b    d0,$500(a0)
  627.     lea    P61_intti(pc),a1
  628.     move.l    a1,P61_tintti(a3)
  629.     move.l    P61_vektori(pc),a2
  630.     move.l    a1,(a2)
  631.     move.b    #$83,$d00(a0)
  632.     move.b    #$11,$e00(a0)
  633.     endc
  634.     endc
  635.  
  636.     ifeq    system
  637.     move    #$e000,$9a(a6)
  638.     moveq    #0,d0
  639.     rts
  640.  
  641.     ifne    exec
  642. P61_liko
  643.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  644.     rte
  645.     endc
  646.     endc
  647.  
  648.     ifne    system
  649.     move.l    a6,-(sp)
  650.  
  651.     ifne    CIA
  652.     clr    P61_server(a3)
  653.     else
  654.     move    #1,P61_server(a3)
  655.     endc
  656.  
  657.     move.l    4.w,a6
  658.     moveq    #-1,d0
  659.     jsr    -$14a(a6)
  660.     move.b    d0,P61_sigbit(a3)
  661.     bmi    P61_err
  662.  
  663.     lea    P61_allocport(pc),a1
  664.     move.l    a1,P61_portti(a3)
  665.     move.b    d0,15(a1)
  666.     move.l    a1,-(sp)
  667.     suba.l    a1,a1
  668.     jsr    -$126(a6)
  669.     move.l    (sp)+,a1
  670.     move.l    d0,16(a1)
  671.     lea    P61_reqlist(pc),a0
  672.     move.l    a0,(a0)
  673.     addq.l    #4,(a0)
  674.     clr.l    4(a0)
  675.     move.l    a0,8(a0)
  676.  
  677.     lea    P61_dat(pc),a1
  678.     move.l    a1,P61_reqdata(a3)
  679.     lea    P61_allocreq(pc),a1
  680.     lea    P61_audiodev(pc),a0
  681.     moveq    #0,d0
  682.     moveq    #0,d1
  683.     jsr    -$1bc(a6)
  684.     tst.b    d0
  685.     bne    P61_err
  686.     st.b    P61_audioopen(a3)
  687.  
  688.     lea    P61_timerint(pc),a1
  689.     move.l    a1,P61_timerdata(a3)
  690.     lea    P61_lev6server(pc),a1
  691.     move.l    a1,P61_timerdata+8(a3)
  692.  
  693.     moveq    #0,d3
  694.     lea    P61_cianame(pc),a1
  695. P61_openciares
  696.     moveq    #0,d0
  697.     move.l    4.w,a6
  698.     jsr    -$1f2(a6)
  699.     move.l    d0,P61_ciares(a3)
  700.     beq.b    P61_err
  701.     move.l    d0,a6
  702.     lea    P61_timerinterrupt(pc),a1
  703.     moveq    #0,d0
  704.     jsr    -6(a6)
  705.     tst.l    d0
  706.     beq.b    P61_gottimer
  707.     addq.l    #4,d3
  708.     lea    P61_timerinterrupt(pc),a1
  709.     moveq    #1,d0
  710.     jsr    -6(a6)
  711.     tst.l    d0
  712.     bne.b    P61_err
  713.  
  714. P61_gottimer
  715.     lea    P61_craddr+8(pc),a6
  716.     move.l    P61_ciaaddr(pc,d3),d0
  717.     move.l    d0,(a6)
  718.     sub    #$100,d0
  719.     move.l    d0,-(a6)
  720.     moveq    #2,d3
  721.     btst    #9,d0
  722.     bne.b    P61_timerB
  723.     subq.b    #1,d3
  724.     add    #$100,d0
  725. P61_timerB
  726.     add    #$900,d0
  727.     move.l    d0,-(a6)
  728.     move.l    d0,a0
  729.     and.b    #%10000000,(a0)
  730.     move.b    d3,P61_timeropen(a3)
  731.     moveq    #0,d0
  732.  
  733.     ifne    CIA
  734.     move.l    P61_craddr+4(pc),a1
  735.     move.b    P61_tlo(pc),(a1)
  736.     move.b    P61_thi(pc),$100(a1)
  737.     endc
  738.     or.b    #$19,(a0)
  739. P61_pois
  740.     move.l    (sp)+,a6
  741.     rts
  742.  
  743. P61_err    moveq    #-1,d0
  744.     bra.b    P61_pois
  745.     rts
  746.  
  747. P61_ciaaddr
  748.     dc.l    $bfd500,$bfd700
  749.     endc
  750.  
  751. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  752. ;­         Call P61_End to stop the music        ­
  753. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  754. ;­        Uses D0/D1/A0/A1/A3        ­
  755. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  756.  
  757. P61_End    moveq    #0,d0
  758.     move    d0,$a8(a6)
  759.     move    d0,$b8(a6)
  760.     move    d0,$c8(a6)
  761.     move    d0,$d8(a6)
  762.     move    #$f,$96(a6)
  763.  
  764.     and.b    #~2,$bfe001
  765.     move.b    P61_ofilter(pc),d0
  766.     or.b    d0,$bfe001
  767.  
  768.     ifeq    system
  769.     move    #$2000,$9a(a6)
  770.     move.l    P61_vektori(pc),a0
  771.     move.l    P61_oldlev6(pc),(a0)
  772.     lea    $bfd000,a0
  773.     lea    P61_Timers(pc),a1
  774.     move.b    (a1)+,$400(a0)
  775.     move.b    (a1)+,$500(a0)
  776.     move.b    (a1)+,$600(a0)
  777.     move.b    (a1)+,$700(a0)
  778.     move.b    #$10,$e00(a0)
  779.     move.b    #$10,$f00(a0)
  780.  
  781.     else
  782.     move.l    a6,-(sp)
  783.     lea    P61_cn(pc),a3
  784.     moveq    #0,d0
  785.     move.b    P61_timeropen(pc),d0
  786.     beq.b    P61_rem1
  787.     move.l    P61_ciares(pc),a6
  788.     lea    P61_timerinterrupt(pc),a1
  789.     subq.b    #1,d0
  790.     jsr    -12(a6)
  791. P61_rem1
  792.     move.l    4.w,a6
  793.     tst.b    P61_audioopen(a3)
  794.     beq.b    P61_rem2
  795.     lea    P61_allocreq(pc),a1
  796.     jsr    -$1c2(a6)
  797.     clr.b    P61_audioopen(a3)
  798. P61_rem2
  799.     moveq    #0,d0
  800.     move.b    P61_sigbit(pc),d0
  801.     bmi.b    P61_rem3
  802.     jsr    -$150(a6)
  803.     st    P61_sigbit(a3)
  804. P61_rem3
  805.     move.l    (sp)+,a6
  806.     endc
  807.     rts
  808.  
  809.     ifne    fade
  810. P61_mfade
  811.     move    P61_Master(pc),d0
  812.     move    P61_temp0+P61_Shadow(pc),d1
  813.     mulu    d0,d1
  814.     lsr    #6,d1
  815.     move    d1,$a8(a6)
  816.  
  817.     ifgt    channels-1
  818.     move    P61_temp1+P61_Shadow(pc),d1
  819.     mulu    d0,d1
  820.     lsr    #6,d1
  821.     move    d1,$b8(a6)
  822.     endc
  823.  
  824.     ifgt    channels-2
  825.     move    P61_temp2+P61_Shadow(pc),d1
  826.     mulu    d0,d1
  827.     lsr    #6,d1
  828.     move    d1,$c8(a6)
  829.     endc
  830.  
  831.     ifgt    channels-3
  832.     move    P61_temp3+P61_Shadow(pc),d1
  833.     mulu    d0,d1
  834.     lsr    #6,d1
  835.     move    d1,$d8(a6)
  836.     endc
  837.     rts
  838.     endc
  839.     
  840.  
  841. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  842. ;­ Call P61_SetPosition to jump to a specific    ­
  843. ;­          position in the song.        ­
  844. ;­ D0.l --> Position                ­
  845. ;­ Starts from the beginning if out of limits.    ­
  846. ;­              Uses A0/A1/A3/D0-D3        ­
  847. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  848.  
  849. P61_SetPosition
  850.     ifne    jump
  851.     lea    P61_cn(pc),a3
  852.     ifne    P61_pl
  853.     clr    P61_plflag(a3)
  854.     endc
  855.     moveq    #0,d1
  856.     move.b    d0,d1
  857.     move.l    d1,d0
  858.     cmp    P61_slen(a3),d0
  859.     blo.b    .e
  860.     moveq    #0,d0
  861. .e    move    d0,P61_Pos(a3)
  862.     add.l    P61_possibase(pc),d0
  863.     move.l    d0,P61_spos(a3)
  864.  
  865.     moveq    #64,d0
  866.     move    d0,P61_rowpos(a3)
  867.     clr    P61_CRow(a3)
  868.     move.l    P61_spos(pc),a1
  869.     move.l    P61_patternbase(pc),a0
  870.     addq    #1,P61_Pos(a3)
  871.     move.b    (a1)+,d0
  872.     move.l    a1,P61_spos(a3)
  873.     move.l    P61_positionbase(pc),a1
  874.     move    d0,P61_Patt(a3)
  875.     lsl    #3,d0
  876.     add.l    d0,a1
  877.     movem    (a1),d0-d3
  878.     lea    (a0,d0.l),a1
  879.     move    d1,d0
  880.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  881.     lea    (a0,d0.l),a1
  882.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  883.     move    d2,d0
  884.     lea    (a0,d0.l),a1
  885.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  886.     move    d3,d0
  887.     add.l    d0,a0
  888.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  889.     rts
  890.     endc
  891.  
  892. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  893. ;­ Call P61_Music every frame to play the music    ­
  894. ;­      _NOT_ if CIA-version is used!        ­
  895. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  896. ;­              Uses A0-A5/D0-D7        ­
  897. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  898.  
  899. P61_Music
  900.     lea    P61_cn(pc),a3
  901.  
  902.     tst    P61_Play(a3)
  903.     bne.b    P61_ohitaaa
  904.     ifne    CIA
  905.     ifne    system
  906.     move.l    P61_craddr+4(pc),a0
  907.     move.b    P61_tlo2(pc),(a0)
  908.     move.b    P61_thi2(pc),$100(a0)
  909.     endc
  910.     endc
  911.     rts
  912.  
  913. P61_ohitaaa
  914.     ifne    fade
  915.     pea    P61_mfade(pc)
  916.     endc
  917.  
  918.     moveq    #Channel_Block_SIZE,d6
  919.     moveq    #16,d7
  920.  
  921.     move    (a3),d4
  922.     addq    #1,d4
  923.     cmp    P61_speed(pc),d4
  924.     beq    P61_playtime
  925.  
  926.     move    d4,(a3)
  927.  
  928. P61_delay
  929.     ifne    CIA
  930.     ifne    system
  931.     move.l    P61_craddr+4(pc),a0
  932.     move.b    P61_tlo2(pc),(a0)
  933.     move.b    P61_thi2(pc),$100(a0)
  934.     endc
  935.     endc
  936.  
  937.     lea    P61_temp0(pc),a5
  938.     lea    $a0(a6),a4
  939.  
  940.     moveq    #channels-1,d5
  941. P61_lopas
  942.     tst    P61_OnOff(a5)
  943.     beq    P61_contfxdone
  944.     moveq    #$f,d0
  945.     and    (a5),d0
  946.     ifeq    opt020
  947.     add    d0,d0
  948.     move    P61_jtab2(pc,d0),d0
  949.     else
  950.     move    P61_jtab2(pc,d0*2),d0
  951.     endc
  952.     jmp    P61_jtab2(pc,d0)
  953.  
  954. P61_jtab2
  955.     dc    P61_contfxdone-P61_jtab2
  956.  
  957.     ifne    P61_pu
  958.     dc    P61_portup-P61_jtab2
  959.     else
  960.     dc    P61_contfxdone-P61_jtab2
  961.     endc
  962.  
  963.     ifne    P61_pd
  964.     dc    P61_portdwn-P61_jtab2
  965.     else
  966.     dc    P61_contfxdone-P61_jtab2
  967.     endc
  968.  
  969.     ifne    P61_tp
  970.     dc    P61_toneport-P61_jtab2
  971.     else
  972.     dc    P61_contfxdone-P61_jtab2
  973.     endc
  974.  
  975.     ifne    P61_vib
  976.     dc    P61_vib2-P61_jtab2
  977.     else
  978.     dc    P61_contfxdone-P61_jtab2
  979.     endc
  980.  
  981.     ifne    P61_tpvs
  982.     dc    P61_tpochvslide-P61_jtab2
  983.     else
  984.     dc    P61_contfxdone-P61_jtab2
  985.     endc
  986.  
  987.     ifne    P61_vbvs
  988.     dc    P61_vibochvslide-P61_jtab2
  989.     else
  990.     dc    P61_contfxdone-P61_jtab2
  991.     endc
  992.  
  993.     ifne    P61_tre
  994.     dc    P61_tremo-P61_jtab2
  995.     else
  996.     dc    P61_contfxdone-P61_jtab2
  997.     endc
  998.  
  999.     ifne    P61_arp
  1000.     dc    P61_arpeggio-P61_jtab2
  1001.     else
  1002.     dc    P61_contfxdone-P61_jtab2
  1003.     endc
  1004.  
  1005.     dc    P61_contfxdone-P61_jtab2
  1006.  
  1007.     ifne    P61_vs
  1008.     dc    P61_volslide-P61_jtab2
  1009.     else
  1010.     dc    P61_contfxdone-P61_jtab2
  1011.     endc
  1012.  
  1013.     dc    P61_contfxdone-P61_jtab2
  1014.     dc    P61_contfxdone-P61_jtab2
  1015.     dc    P61_contfxdone-P61_jtab2
  1016.  
  1017.     ifne    P61_ec
  1018.     dc    P61_contecommands-P61_jtab2
  1019.     else
  1020.     dc    P61_contfxdone-P61_jtab2
  1021.     endc
  1022.     dc    P61_contfxdone-P61_jtab2
  1023.  
  1024.     ifne    P61_ec
  1025. P61_contecommands
  1026.     move.b    P61_Info(a5),d0
  1027.     and    #$f0,d0
  1028.     lsr    #3,d0
  1029.     move    P61_etab2(pc,d0),d0
  1030.     jmp    P61_etab2(pc,d0)
  1031.  
  1032. P61_etab2
  1033.     dc    P61_contfxdone-P61_etab2
  1034.  
  1035.     ifne    P61_fsu
  1036.     dc    P61_fineup2-P61_etab2
  1037.     else
  1038.     dc    P61_contfxdone-P61_etab2
  1039.     endc
  1040.  
  1041.     ifne    P61_fsd
  1042.     dc    P61_finedwn2-P61_etab2
  1043.     else
  1044.     dc    P61_contfxdone-P61_etab2
  1045.     endc
  1046.  
  1047.     dc    P61_contfxdone-P61_etab2
  1048.     dc    P61_contfxdone-P61_etab2
  1049.  
  1050.     dc    P61_contfxdone-P61_etab2
  1051.     dc    P61_contfxdone-P61_etab2
  1052.  
  1053.     dc    P61_contfxdone-P61_etab2
  1054.     dc    P61_contfxdone-P61_etab2
  1055.  
  1056.     ifne    P61_rt
  1057.     dc    P61_retrig-P61_etab2
  1058.     else
  1059.     dc    P61_contfxdone-P61_etab2
  1060.     endc
  1061.  
  1062.     ifne    P61_fvu
  1063.     dc    P61_finevup2-P61_etab2
  1064.     else
  1065.     dc    P61_contfxdone-P61_etab2
  1066.     endc
  1067.  
  1068.     ifne    P61_fvd
  1069.     dc    P61_finevdwn2-P61_etab2
  1070.     else
  1071.     dc    P61_contfxdone-P61_etab2
  1072.     endc
  1073.  
  1074.     ifne    P61_nc
  1075.     dc    P61_notecut-P61_etab2
  1076.     else
  1077.     dc    P61_contfxdone-P61_etab2
  1078.     endc
  1079.  
  1080.     ifne    P61_nd
  1081.     dc    P61_notedelay-P61_etab2
  1082.     else
  1083.     dc    P61_contfxdone-P61_etab2
  1084.     endc
  1085.  
  1086.     dc    P61_contfxdone-P61_etab2
  1087.     dc    P61_contfxdone-P61_etab2
  1088.     endc
  1089.  
  1090.     ifne    P61_fsu
  1091. P61_fineup2
  1092.     tst    (a3)
  1093.     bne    P61_contfxdone
  1094.     moveq    #$f,d0
  1095.     and.b    P61_Info(a5),d0
  1096.     sub    d0,P61_Period(a5)
  1097.     moveq    #113,d0
  1098.     cmp    P61_Period(a5),d0
  1099.     ble.b    .jup
  1100.     move    d0,P61_Period(a5)
  1101. .jup    move    P61_Period(a5),6(a4)
  1102.     bra    P61_contfxdone
  1103.     endc
  1104.  
  1105.     ifne    P61_fsd
  1106. P61_finedwn2
  1107.     tst    (a3)
  1108.     bne    P61_contfxdone
  1109.     moveq    #$f,d0
  1110.     and.b    P61_Info(a5),d0
  1111.     add    d0,P61_Period(a5)
  1112.     cmp    #856,P61_Period(a5)
  1113.     ble.b    .jup
  1114.     move    #856,P61_Period(a5)
  1115. .jup    move    P61_Period(a5),6(a4)
  1116.     bra    P61_contfxdone
  1117.     endc
  1118.  
  1119.     ifne    P61_fvu
  1120. P61_finevup2
  1121.     tst    (a3)
  1122.     bne    P61_contfxdone
  1123.     moveq    #$f,d0
  1124.     and.b    P61_Info(a5),d0
  1125.     add    d0,P61_Volume(a5)
  1126.     moveq    #64,d0
  1127.     cmp    P61_Volume(a5),d0
  1128.     bge.b    .jup
  1129.     move    d0,P61_Volume(a5)
  1130. .jup    move    P61_Volume(a5),8(a4)
  1131.     bra    P61_contfxdone
  1132.     endc
  1133.  
  1134.     ifne    P61_fvd
  1135. P61_finevdwn2
  1136.     tst    (a3)
  1137.     bne    P61_contfxdone
  1138.     moveq    #$f,d0
  1139.     and.b    P61_Info(a5),d0
  1140.     sub    d0,P61_Volume(a5)
  1141.     bpl.b    .jup
  1142.     clr    P61_Volume(a5)
  1143. .jup    move    P61_Volume(a5),8(a4)
  1144.     bra    P61_contfxdone
  1145.     endc
  1146.  
  1147.     ifne    P61_nc
  1148. P61_notecut
  1149.     moveq    #$f,d0
  1150.     and.b    P61_Info(a5),d0
  1151.     cmp    (a3),d0
  1152.     bne    P61_contfxdone
  1153.     ifeq    fade
  1154.     clr    8(a4)
  1155.     else
  1156.     clr    P61_Shadow(a5)
  1157.     endc
  1158.     clr    P61_Volume(a5)
  1159.     bra    P61_contfxdone
  1160.     endc
  1161.  
  1162.     ifne    P61_nd
  1163. P61_notedelay
  1164.     moveq    #$f,d0
  1165.     and.b    P61_Info(a5),d0
  1166.     cmp    (a3),d0
  1167.     bne    P61_contfxdone
  1168.  
  1169.     moveq    #$7e,d0
  1170.     and.b    (a5),d0
  1171.     beq    P61_contfxdone
  1172.     move    P61_DMABit(a5),d0
  1173.     move    d0,$96(a6)
  1174.     or    d0,P61_dma(a3)
  1175.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1176.     move.l    (a1)+,(a4)+            ;Pointer
  1177.     move    (a1),(a4)+            ;Length
  1178.     move    P61_Period(a5),(a4)
  1179.     subq.l    #6,a4
  1180.  
  1181.     ifeq    system
  1182.     lea    P61_dmason(pc),a1
  1183.     move.l    P61_vektori(pc),a0
  1184.     move.l    a1,(a0)
  1185.     move.b    #$f0,$bfd600
  1186.     move.b    #$01,$bfd700
  1187.     move.b    #$19,$bfdf00
  1188.     else
  1189.     move    #1,P61_server(a3)
  1190.     move.l    P61_craddr+4(pc),a1
  1191.     move.b    #$f0,(a1)
  1192.     move.b    #1,$100(a1)
  1193.     endc
  1194.     bra    P61_contfxdone
  1195.     endc
  1196.  
  1197.     ifne    P61_rt
  1198. P61_retrig
  1199.     subq    #1,P61_RetrigCount(a5)
  1200.     bne    P61_contfxdone
  1201.     move    P61_DMABit(a5),d0
  1202.     move    d0,$96(a6)
  1203.     or    d0,P61_dma(a3)
  1204.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1205.     move.l    (a1)+,(a4)            ;Pointer
  1206.     move    (a1),4(a4)            ;Length
  1207.  
  1208.     ifeq    system
  1209.     lea    P61_dmason(pc),a1
  1210.     move.l    P61_vektori(pc),a0
  1211.     move.l    a1,(a0)
  1212.     move.b    #$f0,$bfd600
  1213.     move.b    #$01,$bfd700
  1214.     move.b    #$19,$bfdf00
  1215.     else
  1216.     move    #1,P61_server(a3)
  1217.     move.l    P61_craddr+4(pc),a1
  1218.     move.b    #$f0,(a1)
  1219.     move.b    #1,$100(a1)
  1220.     endc
  1221.  
  1222.     moveq    #$f,d0
  1223.     and.b    P61_Info(a5),d0
  1224.     move    d0,P61_RetrigCount(a5)
  1225.     bra    P61_contfxdone
  1226.     endc
  1227.  
  1228.     ifne    P61_arp
  1229. P61_arplist
  1230.     dc.b 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1
  1231.  
  1232. P61_arpeggio
  1233.     move    (a3),d0
  1234.     move.b    P61_arplist(pc,d0),d0
  1235.     beq.b    .arp0
  1236.     subq.b    #1,d0
  1237.     beq.b    P61_arp1
  1238.     moveq    #$f,d0
  1239.     and.b    P61_Info(a5),d0
  1240.     bra.b    P61_arp3
  1241.  
  1242. .arp0    move    P61_Note(a5),d0
  1243.     move    P61_periods(pc,d0),6(a4)
  1244.     bra    P61_contfxdone
  1245. P61_arp1
  1246.     move.b    P61_Info(a5),d0
  1247.     lsr    #4,d0
  1248. P61_arp3
  1249.     add    d0,d0
  1250.     add    P61_Note(a5),d0
  1251.     move    P61_periods(pc,d0),6(a4)
  1252.     bra    P61_contfxdone
  1253.     endc
  1254.  
  1255. P61_periods
  1256.     ifne    P61_ft
  1257.     incbin    periods
  1258.     else
  1259.     incbin    periods.nft
  1260.     endc
  1261.  
  1262.     ifne    P61_vs
  1263. P61_volslide
  1264.     move.b    P61_Info(a5),d0
  1265.     sub.b    d0,P61_Volume+1(a5)
  1266.     bpl.b    .test
  1267.     clr    P61_Volume(a5)
  1268.     ifeq    fade
  1269.     clr    8(a4)
  1270.     else
  1271.     clr    P61_Shadow(a5)
  1272.     endc
  1273.     bra    P61_contfxdone
  1274. .test    moveq    #64,d0
  1275.     cmp    P61_Volume(a5),d0
  1276.     bge.b    .ncs
  1277.     move    d0,P61_Volume(a5)
  1278.     ifeq    fade
  1279.     move    d0,8(a4)
  1280.     else
  1281.     move    d0,P61_Shadow(a5)
  1282.     endc
  1283.     bra.b    P61_contfxdone
  1284. .ncs    ifeq    fade
  1285.     move    P61_Volume(a5),8(a4)
  1286.     else
  1287.     move    P61_Volume(a5),P61_Shadow(a5)
  1288.     endc
  1289.     bra.b    P61_contfxdone
  1290.     endc
  1291.  
  1292.     ifne    P61_tpvs
  1293. P61_tpochvslide
  1294.     move.b    P61_Info(a5),d0
  1295.     sub.b    d0,P61_Volume+1(a5)
  1296.     bpl.b    .test
  1297.     clr    P61_Volume(a5)
  1298.     ifeq    fade
  1299.     clr    8(a4)
  1300.     else
  1301.     clr    P61_Shadow(a5)
  1302.     endc
  1303.     bra.b    P61_toneport
  1304. .test    moveq    #64,d0
  1305.     cmp    P61_Volume(a5),d0
  1306.     bge.b    .ncs
  1307.     move    d0,P61_Volume(a5)
  1308. .ncs    ifeq    fade
  1309.     move    P61_Volume(a5),8(a4)
  1310.     else
  1311.     move    P61_Volume(a5),P61_Shadow(a5)
  1312.     endc
  1313.     endc
  1314.  
  1315.     ifne    P61_tp
  1316. P61_toneport
  1317.     move    P61_ToPeriod(a5),d0
  1318.     beq.b    P61_contfxdone
  1319.     move    P61_TPSpeed(a5),d1
  1320.     cmp    P61_Period(a5),d0
  1321.     blt.b    .topoup
  1322.  
  1323.     add    d1,P61_Period(a5)
  1324.     cmp    P61_Period(a5),d0
  1325.     bgt.b    P61_toposetper
  1326.     move    d0,P61_Period(a5)
  1327.     clr    P61_ToPeriod(a5)
  1328.     move    d0,6(a4)
  1329.     bra.b    P61_contfxdone
  1330.  
  1331. .topoup
  1332.     sub    d1,P61_Period(a5)
  1333.     cmp    P61_Period(a5),d0
  1334.     blt.b    P61_toposetper
  1335.     move    d0,P61_Period(a5)
  1336.     clr    P61_ToPeriod(a5)
  1337. P61_toposetper
  1338.     move    P61_Period(a5),6(a4)
  1339.     else
  1340.     nop
  1341.     endc
  1342.  
  1343. P61_contfxdone
  1344.     ifne    P61_il
  1345.     bsr    P61_funk2
  1346.     endc
  1347.  
  1348.     add.l    d6,a5
  1349.     add.l    d7,a4
  1350.     dbf    d5,P61_lopas
  1351.  
  1352.     cmp    P61_speed2(pc),d4
  1353.     beq.b    P61_preplay
  1354.     rts
  1355.  
  1356.     ifne    P61_pu
  1357. P61_portup
  1358.     moveq    #0,D0
  1359.     move.b    P61_Info(a5),d0
  1360.     sub    d0,P61_Period(a5)
  1361.     moveq    #113,d0
  1362.     cmp    P61_Period(a5),d0
  1363.     ble.b    .skip
  1364.     move    d0,P61_Period(a5)
  1365.     move    d0,6(a4)
  1366.     bra.b    P61_contfxdone
  1367. .skip
  1368.     move    P61_Period(a5),6(a4)
  1369.     bra.b    P61_contfxdone
  1370.     endc
  1371.  
  1372.     ifne    P61_pd
  1373. P61_portdwn
  1374.     moveq    #0,d0
  1375.     move.b    P61_Info(a5),d0
  1376.     add    d0,P61_Period(a5)
  1377.     cmp    #856,P61_Period(a5)
  1378.     ble.b    .skip
  1379.     move    #856,d0
  1380.     move    d0,P61_Period(a5)
  1381.     move    d0,6(a4)
  1382.     bra.b    P61_contfxdone
  1383. .skip
  1384.     move    P61_Period(a5),6(a4)
  1385.     bra.b    P61_contfxdone
  1386.     endc
  1387.  
  1388.     ifne    P61_pde
  1389. P61_return
  1390.     rts
  1391.  
  1392. P61_preplay
  1393.     tst    P61_pdflag(a3)
  1394.     bne.b    P61_return
  1395.     else
  1396. P61_preplay
  1397.     endc
  1398.  
  1399.     lea    P61_temp0(pc),a5
  1400.     lea    P61_Samples-16(pc),a0
  1401.  
  1402.     moveq    #channels-1,d5
  1403. P61_loaps
  1404.     ifne    P61_pl
  1405.     lea    P61_TData(a5),a1
  1406.     move    2(a5),(a1)+
  1407.     move.l    P61_ChaPos(a5),(a1)+
  1408.     move.l    P61_TempPos(a5),(a1)+
  1409.     move    P61_TempLen(a5),(a1)
  1410.     endc
  1411.  
  1412.     move.b    P61_Pack(a5),d0
  1413.     and.b    #$3f,d0
  1414.     beq.b    P61_takeone
  1415.  
  1416.     tst.b    P61_Pack(a5)
  1417.     bmi.b    .keepsame
  1418.  
  1419.     subq.b    #1,P61_Pack(a5)
  1420.     clr    P61_OnOff(a5)            ; Empty row
  1421.     add.l    d6,a5
  1422.     dbf    d5,P61_loaps
  1423.     rts
  1424.  
  1425. .keepsame
  1426.     subq.b    #1,P61_Pack(a5)
  1427.     bra    P61_dko
  1428.  
  1429. P61_takeone
  1430.     tst.b    P61_TempLen+1(a5)
  1431.     beq    P61_takenorm
  1432.  
  1433.     subq.b    #1,P61_TempLen+1(a5)
  1434.     move.l    P61_TempPos(a5),a2
  1435.  
  1436. P61_jedi
  1437.     move.b    (a2)+,d0
  1438.     moveq    #%01100000,d1
  1439.     and.b    d0,d1
  1440.     cmp.b    #%01100000,d1
  1441.     bne.b    .all
  1442.  
  1443.     moveq    #%01110000,d1
  1444.     and.b    d0,d1
  1445.     cmp.b    #%01110000,d1
  1446.     bne.b    .cmd
  1447.  
  1448.     moveq    #%01111000,d1
  1449.     and.b    d0,d1
  1450.     cmp.b    #%01111000,d1
  1451.     bne.b    .note
  1452.  
  1453. .empty    clr    P61_OnOff(a5)            ; Empty row
  1454.     clr    (a5)+
  1455.     clr.b    (a5)+
  1456.     tst.b    d0
  1457.     bpl.b    .ex
  1458.     move.b    (a2)+,(a5)            ; Compression info
  1459.     bra.b    .ex
  1460.  
  1461. .all    move.b    d0,(a5)+
  1462.     ifeq    opt020
  1463.     move.b    (a2)+,(a5)+
  1464.     move.b    (a2)+,(a5)+
  1465.     else
  1466.     move    (a2)+,(a5)+
  1467.     endc
  1468.     tst.b    d0
  1469.     bpl.b    .ex
  1470.     move.b    (a2)+,(a5)            ; Compression info
  1471.     bra.b    .ex
  1472.  
  1473. .cmd    moveq    #$f,d1
  1474.     and    d0,d1
  1475.     move    d1,(a5)+            ; cmd
  1476.     move.b    (a2)+,(a5)+            ; info
  1477.     tst.b    d0
  1478.     bpl.b    .ex
  1479.     move.b    (a2)+,(a5)            ; Compression info
  1480.     bra.b    .ex
  1481.  
  1482. .note    moveq    #7,d1
  1483.     and    d0,d1
  1484.     lsl    #8,d1
  1485.     move.b    (a2)+,d1
  1486.     lsl    #4,d1
  1487.     move    d1,(a5)+
  1488.     clr.b    (a5)+    
  1489.     tst.b    d0
  1490.     bpl.b    .ex
  1491.     move.b    (a2)+,(a5)            ; Compression info
  1492. .ex    subq.l    #3,a5
  1493.     move.l    a2,P61_TempPos(a5)
  1494.     bra    P61_dko
  1495.  
  1496.  
  1497. P61_takenorm
  1498.     move.l    P61_ChaPos(a5),a2
  1499.  
  1500.     move.b    (a2)+,d0
  1501.     moveq    #%01100000,d1
  1502.     and.b    d0,d1
  1503.     cmp.b    #%01100000,d1
  1504.     bne.b    .all
  1505.  
  1506.     moveq    #%01110000,d1
  1507.     and.b    d0,d1
  1508.     cmp.b    #%01110000,d1
  1509.     bne.b    .cmd
  1510.  
  1511.     moveq    #%01111000,d1
  1512.     and.b    d0,d1
  1513.     cmp.b    #%01111000,d1
  1514.     bne.b    .note
  1515.  
  1516. .empty    clr    P61_OnOff(a5)            ; Empty row
  1517.     clr    (a5)+
  1518.     clr.b    (a5)+
  1519.     tst.b    d0
  1520.     bpl.b    .proccomp
  1521.     move.b    (a2)+,(a5)            ; Compression info
  1522.     bra.b    .proccomp
  1523.  
  1524.  
  1525. .all    move.b    d0,(a5)+
  1526.     ifeq    opt020
  1527.     move.b    (a2)+,(a5)+
  1528.     move.b    (a2)+,(a5)+
  1529.     else
  1530.     move    (a2)+,(a5)+
  1531.     endc
  1532.     tst.b    d0
  1533.     bpl.b    .proccomp
  1534.     move.b    (a2)+,(a5)            ; Compression info
  1535.     bra.b    .proccomp
  1536.  
  1537. .cmd    moveq    #$f,d1
  1538.     and    d0,d1
  1539.     move    d1,(a5)+            ; cmd
  1540.     move.b    (a2)+,(a5)+            ; info
  1541.     tst.b    d0
  1542.     bpl.b    .proccomp
  1543.     move.b    (a2)+,(a5)            ; Compression info
  1544.     bra.b    .proccomp
  1545.  
  1546. .note    moveq    #7,d1
  1547.     and    d0,d1
  1548.     lsl    #8,d1
  1549.     move.b    (a2)+,d1
  1550.     lsl    #4,d1
  1551.     move    d1,(a5)+
  1552.     clr.b    (a5)+    
  1553.     tst.b    d0
  1554.     bpl.b    .proccomp
  1555.     move.b    (a2)+,(a5)            ; Compression info
  1556.  
  1557. .proccomp
  1558.     subq.l    #3,a5
  1559.     move.l    a2,P61_ChaPos(a5)
  1560.  
  1561.     tst.b    d0
  1562.     bpl.b    P61_dko
  1563.  
  1564.     move.b    3(a5),d0
  1565.     move.b    d0,d1
  1566.     and    #%11000000,d1
  1567.     beq.b    P61_dko                ; Empty datas
  1568.     cmp.b    #%10000000,d1
  1569.     beq.b    P61_dko                ; Same datas
  1570.  
  1571.     clr.b    3(a5)
  1572.     and    #$3f,d0
  1573.     move.b    d0,P61_TempLen+1(a5)
  1574.  
  1575.     cmp.b    #%11000000,d1
  1576.     beq.b    .bit16                ; 16-bit
  1577.  
  1578.     moveq    #0,d0                ; 8-bit
  1579.     move.b    (a2)+,d0
  1580.     move.l    a2,P61_ChaPos(a5)
  1581.     sub.l    d0,a2
  1582.     bra    P61_jedi
  1583.  
  1584. .bit16    moveq    #0,d0
  1585.     ifeq    opt020
  1586.     move.b    (a2)+,d0
  1587.     lsl    #8,d0
  1588.     move.b    (a2)+,d0
  1589.     else
  1590.     move    (a2)+,d0
  1591.     endc
  1592.  
  1593.     move.l    a2,P61_ChaPos(a5)
  1594.     sub.l    d0,a2
  1595.     bra    P61_jedi
  1596.  
  1597.  
  1598. P61_dko    st    P61_OnOff(a5)
  1599.     move    (a5),d0
  1600.     and    #$1f0,d0
  1601.     beq.b    .koto
  1602.     lea    (a0,d0),a1
  1603.     move.l    a1,P61_Sample(a5)
  1604.     ifne    P61_ft
  1605.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1606.     else
  1607.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1608.     endc
  1609.     ifne    P61_il
  1610.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1611.     endc
  1612.     ifne    P61_sof
  1613.     clr    P61_Offset(a5)
  1614.     endc
  1615.  
  1616. .koto    add.l    d6,a5
  1617.     dbf    d5,P61_loaps
  1618.     rts
  1619.  
  1620. P61_playtime
  1621.     clr    (a3)
  1622.  
  1623.     ifne    P61_pde
  1624.     tst    P61_pdelay(a3)
  1625.     beq.b    .djdj
  1626.     subq    #1,P61_pdelay(a3)
  1627.     bra    P61_delay
  1628. .djdj
  1629.     endc
  1630.  
  1631.     clr    P61_pdflag(a3)
  1632.  
  1633.     tst    P61_speedis1(a3)
  1634.     beq.b    .mo
  1635.     bsr    P61_preplay
  1636.  
  1637. .mo    lea    P61_temp0(pc),a5
  1638.     lea    $a0(a6),a4
  1639.  
  1640.     ifeq    system
  1641.     lea    P61_dmason(pc),a1
  1642.     move.l    P61_vektori(pc),a0
  1643.     move.l    a1,(a0)
  1644.     move.b    #$f0,$bfd600
  1645.     move.b    #$01,$bfd700
  1646.     move.b    #$19,$bfdf00
  1647.     else
  1648.     move    #1,P61_server(a3)
  1649.     move.l    P61_craddr+4(pc),a1
  1650.     move.b    #$f0,(a1)
  1651.     move.b    #1,$100(a1)
  1652.     endc
  1653.  
  1654.     lea    P61_periods(pc),a2
  1655.  
  1656.     moveq    #0,d4
  1657.     moveq    #channels-1,d5
  1658. P61_los    tst    P61_OnOff(a5)
  1659.     beq    P61_nocha
  1660.  
  1661.     moveq    #$f,d0
  1662.     and    (a5),d0
  1663.     lea    P61_jtab(pc),a1
  1664.     add    d0,d0
  1665.     add.l    d0,a1
  1666.     add    (a1),a1
  1667.     jmp    (a1)
  1668.  
  1669. P61_fxdone
  1670.     moveq    #$7e,d0
  1671.     and.b    (a5),d0
  1672.     beq.b    P61_nocha
  1673.     ifne    P61_vib
  1674.     clr.b    P61_VibPos(a5)
  1675.     endc
  1676.     ifne    P61_tre
  1677.     clr.b    P61_TrePos(a5)
  1678.     endc
  1679.  
  1680.      ifne    P61_ft
  1681.     add    P61_Fine(a5),d0
  1682.     endc
  1683.     move    d0,P61_Note(a5)
  1684.     move    (a2,d0),P61_Period(a5)
  1685.  
  1686. P61_zample
  1687.     ifne    P61_sof
  1688.     tst    P61_Offset(a5)
  1689.     bne    P61_pek
  1690.     endc
  1691.  
  1692.     or    P61_DMABit(a5),d4
  1693.     move    d4,$96(a6)
  1694.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1695.     move.l    (a1)+,(a4)            ;Pointer
  1696.     move    (a1),4(a4)            ;Length
  1697.  
  1698. P61_nocha
  1699.     ifeq    fade
  1700.     move.l    P61_Period(a5),6(a4)
  1701.     else
  1702.     move    P61_Period(a5),6(a4)
  1703.     move    P61_Volume(a5),P61_Shadow(a5)
  1704.     endc
  1705.  
  1706. P61_skip
  1707.     ifne    P61_il
  1708.     bsr    P61_funk2
  1709.     endc
  1710.  
  1711.     add.l    d6,a5
  1712.     add.l    d7,a4
  1713.     dbf    d5,P61_los
  1714.  
  1715.     move.b    d4,P61_dma+1(a3)
  1716.  
  1717.     ifne    P61_pl
  1718.     tst.b    P61_plflag+1(a3)
  1719.     beq.b    P61_ohittaa
  1720.  
  1721.     lea    P61_temp0(pc),a1
  1722.     lea    P61_looppos(pc),a0
  1723.     moveq    #channels-1,d0
  1724. .talt    move.b    1(a0),3(a1)
  1725.     addq.l    #2,a0
  1726.     move.l    (a0)+,P61_ChaPos(a1)
  1727.     move.l    (a0)+,P61_TempPos(a1)
  1728.     move    (a0)+,P61_TempLen(a1)
  1729.     add.l    d6,a1
  1730.     dbf    d0,.talt
  1731.  
  1732.     move    P61_plrowpos(pc),P61_rowpos(a3)
  1733.     clr.b    P61_plflag+1(a3)
  1734.     moveq    #63,d0
  1735.     sub    P61_rowpos(a3),d0
  1736.     move    d0,P61_CRow(a3)
  1737.     rts
  1738.     endc
  1739.  
  1740. P61_ohittaa
  1741.     subq    #1,P61_rowpos(a3)
  1742.     bmi.b    P61_nextpattern
  1743.     moveq    #63,d0
  1744.     sub    P61_rowpos(a3),d0
  1745.     move    d0,P61_CRow(a3)
  1746.     rts
  1747.  
  1748. P61_nextpattern
  1749.     ifne    P61_pl
  1750.     clr    P61_plflag(a3)
  1751.     endc
  1752.     move.l    P61_patternbase(pc),a4
  1753.     moveq    #63,d0
  1754.     move    d0,P61_rowpos(a3)
  1755.     clr    P61_CRow(a3)
  1756.     move.l    P61_spos(pc),a1
  1757.     addq    #1,P61_Pos(a3)
  1758.     move.b    (a1)+,d0
  1759.     bpl.b    P61_dk
  1760.     move.l    P61_possibase(pc),a1
  1761.     move.b    (a1)+,d0
  1762.     clr    P61_Pos(a3)
  1763. P61_dk    move.l    a1,P61_spos(a3)
  1764.     move    d0,P61_Patt(a3)
  1765.     lsl    #3,d0
  1766.     move.l    P61_positionbase(pc),a1
  1767.     add.l    d0,a1
  1768.  
  1769.     move    (a1)+,d0
  1770.     lea    (a4,d0.l),a2
  1771.     move.l    a2,P61_ChaPos+P61_temp0(a3)
  1772.     move    (a1)+,d0
  1773.     lea    (a4,d0.l),a2
  1774.     move.l    a2,P61_ChaPos+P61_temp1(a3)
  1775.     move    (a1)+,d0
  1776.     lea    (a4,d0.l),a2
  1777.     move.l    a2,P61_ChaPos+P61_temp2(a3)
  1778.     move    (a1),d0
  1779.     add.l    d0,a4
  1780.     move.l    a4,P61_ChaPos+P61_temp3(a3)
  1781.     rts
  1782.  
  1783.     ifne    P61_tp
  1784. P61_settoneport
  1785.     move.b    P61_Info(a5),d0
  1786.     beq.b    P61_toponochange
  1787.     move.b    d0,P61_TPSpeed+1(a5)
  1788. P61_toponochange
  1789.     moveq    #$7e,d0
  1790.     and.b    (a5),d0
  1791.     beq    P61_nocha
  1792.     add    P61_Fine(a5),d0
  1793.     move    d0,P61_Note(a5)
  1794.     move    (a2,d0),P61_ToPeriod(a5)
  1795.     bra    P61_nocha
  1796.     endc
  1797.  
  1798.     ifne    P61_sof
  1799. P61_sampleoffse
  1800.     moveq    #$7e,d0
  1801.     and.b    (a5),d0
  1802.     beq    P61_nocha
  1803.     ifne    P61_vib
  1804.     clr.b    P61_VibPos(a5)
  1805.     endc
  1806.     ifne    P61_tre
  1807.     clr.b    P61_TrePos(a5)
  1808.     endc
  1809.  
  1810.     ifne    P61_ft
  1811.     add    P61_Fine(a5),d0
  1812.     endc
  1813.     move    d0,P61_Note(a5)
  1814.     move    (a2,d0),P61_Period(a5)
  1815.  
  1816.     moveq    #0,d1
  1817.     move    #$ff00,d1
  1818.     and    2(a5),d1
  1819.     bne.b    .deq
  1820.     move    P61_LOffset(a5),d1
  1821. .deq    move    d1,P61_LOffset(a5)
  1822.     add    d1,P61_Offset(a5)
  1823.     move    P61_Offset(a5),d2
  1824.  
  1825.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  1826.     bra.b    P61_hup
  1827.  
  1828. P61_pek    moveq    #0,d1
  1829.     move    P61_Offset(a5),d1
  1830. P61_hup    or    P61_DMABit(a5),d4
  1831.     move    d4,$96(a6)
  1832.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1833.     move.l    (a1)+,d0
  1834.     add.l    d1,d0
  1835.     move.l    d0,(a4)                ;Pointer
  1836.     lsr    #1,d1
  1837.     move    (a1),d0
  1838.     sub    d1,d0
  1839.     bpl.b    P61_offok
  1840.     move.l    -4(a1),(a4)            ;Pointer is over the end
  1841.     moveq    #1,d0
  1842. P61_offok
  1843.     move    d0,4(a4)            ;Length
  1844.     bra    P61_nocha
  1845.     endc
  1846.  
  1847.     ifne    P61_vl
  1848. P61_volum
  1849.     move.b    P61_Info(a5),P61_Volume+1(a5)
  1850.     bra    P61_fxdone
  1851.     endc
  1852.  
  1853.     ifne    P61_pj
  1854. P61_posjmp
  1855.     moveq    #0,d0
  1856.     move.b    P61_Info(a5),d0
  1857.     cmp    P61_slen(a3),d0
  1858.     blo.b    .e
  1859.     moveq    #0,d0
  1860. .e    move    d0,P61_Pos(a3)
  1861.     add.l    P61_possibase(pc),d0
  1862.     move.l    d0,P61_spos(a3)
  1863.     endc
  1864.  
  1865.     ifne    P61_pb
  1866. P61_pattbreak
  1867.     moveq    #64,d0
  1868.     move    d0,P61_rowpos(a3)
  1869.     clr    P61_CRow(a3)
  1870.     move.l    P61_spos(pc),a1
  1871.     move.l    P61_patternbase(pc),a0
  1872.     addq    #1,P61_Pos(a3)
  1873.     move.b    (a1)+,d0
  1874.     bpl.b    P61_dk2
  1875.     move.l    P61_possibase(pc),a1
  1876.     move.b    (a1)+,d0
  1877.     clr    P61_Pos(a3)
  1878. P61_dk2    move.l    a1,P61_spos(a3)
  1879.     move.l    P61_positionbase(pc),a1
  1880.     move    d0,P61_Patt(a3)
  1881.     lsl    #3,d0
  1882.     add.l    d0,a1
  1883.     movem    (a1),d0-d3
  1884.     lea    (a0,d0.l),a1
  1885.     move    d1,d0
  1886.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  1887.     lea    (a0,d0.l),a1
  1888.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  1889.     move    d2,d0
  1890.     lea    (a0,d0.l),a1
  1891.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  1892.     move    d3,d0
  1893.     add.l    d0,a0
  1894.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  1895.     bra    P61_fxdone
  1896.     endc
  1897.  
  1898.     ifne    P61_vib
  1899. P61_vibrato
  1900.     move.b    P61_Info(a5),d0
  1901.     beq    P61_fxdone
  1902.     move.b    d0,d1
  1903.     move.b    P61_VibCmd(a5),d2
  1904.     and.b    #$f,d0
  1905.     beq.b    P61_vibskip
  1906.     and.b    #$f0,d2
  1907.     or.b    d0,d2
  1908. P61_vibskip
  1909.     and.b    #$f0,d1
  1910.     beq.b    P61_vibskip2
  1911.     and.b    #$f,d2
  1912.     or.b    d1,d2
  1913. P61_vibskip2
  1914.     move.b    d2,P61_VibCmd(a5)
  1915.     bra    P61_fxdone
  1916.     endc
  1917.  
  1918.     ifne    P61_tre
  1919. P61_settremo
  1920.     move.b    P61_Info(a5),d0
  1921.     beq    P61_fxdone
  1922.     move.b    d0,d1
  1923.     move.b    P61_TreCmd(a5),d2
  1924.     moveq    #$f,d3
  1925.     and.b    d3,d0
  1926.     beq.b    P61_treskip
  1927.     and.b    #$f0,d2
  1928.     or.b    d0,d2
  1929. P61_treskip
  1930.     and.b    #$f0,d1
  1931.     beq.b    P61_treskip2
  1932.     and.b    d3,d2
  1933.     or.b    d1,d2
  1934. P61_treskip2
  1935.     move.b    d2,P61_TreCmd(a5)
  1936.     bra    P61_fxdone
  1937.     endc
  1938.  
  1939.     ifne    P61_ec
  1940. P61_ecommands
  1941.     move.b    P61_Info(a5),d0
  1942.     and.b    #$f0,d0
  1943.     lsr    #3,d0
  1944.     move    P61_etab(pc,d0),d0
  1945.     jmp    P61_etab(pc,d0)
  1946.  
  1947. P61_etab
  1948.     ifne    P61_fi
  1949.     dc    P61_filter-P61_etab
  1950.     else
  1951.     dc    P61_fxdone-P61_etab
  1952.     endc
  1953.  
  1954.     ifne    P61_fsu
  1955.     dc    P61_fineup-P61_etab
  1956.     else
  1957.     dc    P61_fxdone-P61_etab
  1958.     endc
  1959.  
  1960.     ifne    P61_fsd
  1961.     dc    P61_finedwn-P61_etab
  1962.     else
  1963.     dc    P61_fxdone-P61_etab
  1964.     endc
  1965.  
  1966.     dc    P61_fxdone-P61_etab
  1967.     dc    P61_fxdone-P61_etab
  1968.  
  1969.     ifne    P61_sft
  1970.     dc    P61_setfinetune-P61_etab
  1971.     else
  1972.     dc    P61_fxdone-P61_etab
  1973.     endc
  1974.  
  1975.     ifne    P61_pl
  1976.     dc    P61_patternloop-P61_etab
  1977.     else
  1978.     dc    P61_fxdone-P61_etab
  1979.     endc
  1980.  
  1981.     dc    P61_fxdone-P61_etab
  1982.  
  1983.     ifne    P61_timing
  1984.     dc    P61_sete8-P61_etab
  1985.     else
  1986.     dc    P61_fxdone-P61_etab
  1987.     endc
  1988.  
  1989.     ifne    P61_rt
  1990.     dc    P61_setretrig-P61_etab
  1991.     else
  1992.     dc    P61_fxdone-P61_etab
  1993.     endc
  1994.  
  1995.     ifne    P61_fvu
  1996.     dc    P61_finevup-P61_etab
  1997.     else
  1998.     dc    P61_fxdone-P61_etab
  1999.     endc
  2000.  
  2001.     ifne    P61_fvd
  2002.     dc    P61_finevdwn-P61_etab
  2003.     else
  2004.     dc    P61_fxdone-P61_etab
  2005.     endc
  2006.  
  2007.     dc    P61_fxdone-P61_etab
  2008.  
  2009.     ifne    P61_nd
  2010.     dc    P61_ndelay-P61_etab
  2011.     else
  2012.     dc    P61_fxdone-P61_etab
  2013.     endc
  2014.  
  2015.     ifne    P61_pde
  2016.     dc    P61_pattdelay-P61_etab
  2017.     else
  2018.     dc    P61_fxdone-P61_etab
  2019.     endc
  2020.  
  2021.     ifne    P61_il
  2022.     dc    P61_funk-P61_etab
  2023.     else
  2024.     dc    P61_fxdone-P61_etab
  2025.     endc
  2026.     endc
  2027.  
  2028.     ifne    P61_fi
  2029. P61_filter
  2030.     move.b    P61_Info(a5),d0
  2031.     and.b    #$fd,$bfe001
  2032.     or.b    d0,$bfe001
  2033.     bra    P61_fxdone
  2034.     endc
  2035.  
  2036.     ifne    P61_fsu
  2037. P61_fineup
  2038.     P61_getnote
  2039.  
  2040.     moveq    #$f,d0
  2041.     and.b    P61_Info(a5),d0
  2042.     sub    d0,P61_Period(a5)
  2043.     moveq    #113,d0
  2044.     cmp    P61_Period(a5),d0
  2045.     ble.b    .jup
  2046.     move    d0,P61_Period(a5)
  2047. .jup    moveq    #$7e,d0
  2048.     and.b    (a5),d0
  2049.     bne    P61_zample
  2050.     bra    P61_nocha
  2051.     endc
  2052.  
  2053.     ifne    P61_fsd
  2054. P61_finedwn
  2055.     P61_getnote
  2056.  
  2057.     moveq    #$f,d0
  2058.     and.b    P61_Info(a5),d0
  2059.     add    d0,P61_Period(a5)
  2060.     cmp    #856,P61_Period(a5)
  2061.     ble.b    .jup
  2062.     move    #856,P61_Period(a5)
  2063. .jup    moveq    #$7e,d0
  2064.     and.b    (a5),d0
  2065.     bne    P61_zample
  2066.     bra    P61_nocha
  2067.     endc
  2068.  
  2069.     ifne    P61_sft
  2070. P61_setfinetune
  2071.     moveq    #$f,d0
  2072.     and.b    P61_Info(a5),d0
  2073.     ifeq    opt020
  2074.     add    d0,d0
  2075.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  2076.     else
  2077.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  2078.     endc
  2079.     bra    P61_fxdone
  2080.  
  2081. P61_mulutab
  2082.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  2083.     endc
  2084.  
  2085.     ifne    P61_pl
  2086. P61_patternloop
  2087.     moveq    #$f,d0
  2088.     and.b    P61_Info(a5),d0
  2089.     beq.b    P61_setloop
  2090.  
  2091.     tst.b    P61_plflag(a3)
  2092.     bne.b    P61_noset
  2093.  
  2094.     move    d0,P61_plcount(a3)
  2095.     st.b    P61_plflag(a3)
  2096. P61_noset
  2097.     tst    P61_plcount(a3)
  2098.     bne.b    P61_looppaa
  2099.     clr.b    P61_plflag(a3)
  2100.     bra    P61_fxdone
  2101.     
  2102. P61_looppaa
  2103.     st.b    P61_plflag+1(a3)
  2104.     subq    #1,P61_plcount(a3)
  2105.     bra    P61_fxdone
  2106.  
  2107. P61_setloop
  2108.     tst.b    P61_plflag(a3)
  2109.     bne    P61_fxdone
  2110.     move    P61_rowpos(pc),P61_plrowpos(a3)
  2111.     lea    P61_temp0+P61_TData(pc),a1
  2112.     lea    P61_looppos(pc),a0
  2113.     moveq    #channels-1,d0
  2114. .talt    move.l    (a1)+,(a0)+
  2115.     move.l    (a1)+,(a0)+
  2116.     move.l    (a1),(a0)+
  2117.     subq.l    #8,a1
  2118.     add.l    d6,a1
  2119.     dbf    d0,.talt
  2120.     bra    P61_fxdone
  2121.     endc
  2122.  
  2123.     ifne    P61_fvu
  2124. P61_finevup
  2125.     moveq    #$f,d0
  2126.     and.b    P61_Info(a5),d0
  2127.     add    d0,P61_Volume(a5)
  2128.     moveq    #64,d0
  2129.     cmp    P61_Volume(a5),d0
  2130.     bge    P61_fxdone
  2131.     move    d0,P61_Volume(a5)
  2132.     bra    P61_fxdone
  2133.     endc
  2134.  
  2135.     ifne    P61_fvd
  2136. P61_finevdwn
  2137.     moveq    #$f,d0
  2138.     and.b    P61_Info(a5),d0
  2139.     sub    d0,P61_Volume(a5)
  2140.     bpl    P61_fxdone
  2141.     clr    P61_Volume(a5)
  2142.     bra    P61_fxdone
  2143.     endc
  2144.  
  2145.     ifne    P61_timing
  2146. P61_sete8
  2147.     moveq    #$f,d0
  2148.     and.b    P61_Info(a5),d0
  2149.     move    d0,P61_E8(a3)
  2150.     bra    P61_fxdone
  2151.     endc
  2152.  
  2153.     ifne    P61_rt
  2154. P61_setretrig
  2155.     moveq    #$f,d0
  2156.     and.b    P61_Info(a5),d0
  2157.     move    d0,P61_RetrigCount(a5)
  2158.     bra    P61_fxdone
  2159.     endc
  2160.  
  2161.     ifne    P61_nd
  2162. P61_ndelay
  2163.     moveq    #$7e,d0
  2164.     and.b    (a5),d0
  2165.     beq    P61_skip
  2166.     ifne    P61_vib
  2167.     clr.b    P61_VibPos(a5)
  2168.     endc
  2169.     ifne    P61_tre
  2170.     clr.b    P61_TrePos(a5)
  2171.     endc
  2172.     ifne    P61_ft
  2173.     add    P61_Fine(a5),d0
  2174.     endc
  2175.     move    d0,P61_Note(a5)
  2176.     move    (a2,d0),P61_Period(a5)
  2177.     ifeq    fade
  2178.     move    P61_Volume(a5),8(a4)
  2179.     else
  2180.     move    P61_Volume(a5),P61_Shadow(a5)
  2181.     endc
  2182.     bra    P61_skip
  2183.     endc
  2184.  
  2185.     ifne    P61_pde
  2186. P61_pattdelay
  2187.     moveq    #$f,d0
  2188.     and.b    P61_Info(a5),d0
  2189.     move    d0,P61_pdelay(a3)
  2190.     st    P61_pdflag(a3)
  2191.     bra    P61_fxdone
  2192.     endc
  2193.  
  2194.     ifne    P61_sd
  2195. P61_cspeed
  2196.     moveq    #0,d0
  2197.     move.b    P61_Info(a5),d0
  2198.  
  2199.     ifne    CIA
  2200.     tst    P61_Tempo(a3)
  2201.     beq.b    P61_VBlank
  2202.     cmp.b    #32,d0
  2203.     bhs.b    P61_STempo
  2204.     endc
  2205.  
  2206. P61_VBlank
  2207.     cmp.b    #1,d0
  2208.     beq.b    P61_jkd
  2209.  
  2210.     move.b    d0,P61_speed+1(a3)
  2211.     subq.b    #1,d0
  2212.     move.b    d0,P61_speed2+1(a3)
  2213.     clr    P61_speedis1(a3)
  2214.     bra    P61_fxdone
  2215.  
  2216. P61_jkd    move.b    d0,P61_speed+1(a3)
  2217.     move.b    d0,P61_speed2+1(a3)
  2218.     st    P61_speedis1(a3)
  2219.     bra    P61_fxdone
  2220.  
  2221.  
  2222.     ifne    CIA
  2223. P61_STempo
  2224.     move.l    P61_timer(pc),d1
  2225.     divu    d0,d1
  2226.     move    d1,P61_thi2(a3)
  2227.     sub    #$1f0*2,d1
  2228.     move    d1,P61_thi(a3)
  2229.  
  2230.     ifeq    system
  2231.     move    P61_thi2(a3),d1
  2232.     move.b    d1,$bfd400
  2233.     lsr    #8,d1
  2234.     move.b    d1,$bfd500
  2235.     endc
  2236.  
  2237.     bra    P61_fxdone
  2238.     endc
  2239.     endc
  2240.  
  2241.  
  2242.  
  2243.     ifne    P61_vbvs
  2244. P61_vibochvslide
  2245.     move.b    P61_Info(a5),d0
  2246.     sub.b    d0,P61_Volume+1(a5)
  2247.     bpl.b    P61_test62
  2248.     clr    P61_Volume(a5)
  2249.     ifeq    fade
  2250.     clr    8(a4)
  2251.     else
  2252.     clr    P61_Shadow(a5)
  2253.     endc
  2254.     bra.b    P61_vib2
  2255. P61_test62
  2256.     moveq    #64,d0
  2257.     cmp    P61_Volume(a5),d0
  2258.     bge.b    .ncs2
  2259.     move    d0,P61_Volume(a5)
  2260. .ncs2    ifeq    fade
  2261.     move    P61_Volume(a5),8(a4)
  2262.     else
  2263.     move    P61_Volume(a5),P61_Shadow(a5)
  2264.     endc
  2265.     endc
  2266.  
  2267.     ifne    P61_vib
  2268. P61_vib2
  2269.     move    #$f00,d0
  2270.     move    P61_VibCmd(a5),d1
  2271.     and    d1,d0
  2272.     lsr    #3,d0
  2273.  
  2274.     lsr    #2,d1
  2275.     and    #$1f,d1
  2276.     add    d1,d0
  2277.  
  2278.     move    P61_Period(a5),d1
  2279.     moveq    #0,d2
  2280.     move.b    P61_vibtab(pc,d0),d2
  2281.  
  2282.     tst.b    P61_VibPos(a5)
  2283.     bmi.b    .vibneg
  2284.     add    d2,d1
  2285.     bra.b    P61_vib4
  2286.  
  2287. .vibneg    sub    d2,d1
  2288.  
  2289. P61_vib4
  2290.     move    d1,6(a4)
  2291.     move.b    P61_VibCmd(a5),d0
  2292.     lsr.b    #2,d0
  2293.     and    #$3c,d0
  2294.     add.b    d0,P61_VibPos(a5)
  2295.     bra    P61_contfxdone
  2296.     endc
  2297.  
  2298.     ifne    P61_tre
  2299. P61_tremo
  2300.     move    #$f00,d0
  2301.     move    P61_TreCmd(a5),d1
  2302.     and    d1,d0
  2303.     lsr    #3,d0
  2304.     
  2305.     lsr    #2,d1
  2306.     and    #$1f,d1
  2307.     add    d1,d0
  2308.  
  2309.     move    P61_Volume(a5),d1
  2310.     moveq    #0,d2
  2311.     move.b    P61_vibtab(pc,d0),d2
  2312.  
  2313.     tst.b    P61_TrePos(a5)
  2314.     bmi.b    .treneg
  2315.     add    d2,d1
  2316.     cmp    #64,d1
  2317.     ble.b    P61_tre4
  2318.     moveq    #64,d1
  2319.     bra.b    P61_tre4
  2320.  
  2321. .treneg    sub    d2,d1
  2322.     bpl.b    P61_tre4
  2323.     moveq    #0,d1
  2324. P61_tre4
  2325.     ifeq    fade
  2326.     move    d1,8(a4)
  2327.     else
  2328.     move    d1,P61_Shadow(a5)
  2329.     endc
  2330.  
  2331.     move.b    P61_TreCmd(a5),d0
  2332.     lsr.b    #2,d0
  2333.     and    #$3c,d0
  2334.     add.b    d0,P61_TrePos(a5)
  2335.     bra    P61_contfxdone
  2336.     endc
  2337.  
  2338.     ifne    P61_vib!P61_tre
  2339. P61_vibtab    incbin    vibtab
  2340.     endc
  2341.  
  2342.     ifne    P61_il
  2343. P61_funk
  2344.     moveq    #$f,d0
  2345.     and.b    P61_Info(a5),d0
  2346.     move.b    d0,P61_Funkspd(a5)
  2347.     bra    P61_fxdone
  2348.  
  2349. P61_funk2
  2350.     moveq    #0,d0
  2351.     move.b    P61_Funkspd(a5),d0
  2352.     beq.b    P61_funkend
  2353.     move.b    P61_FunkTable(pc,d0),d0
  2354.     add.b    d0,P61_Funkoff(a5)
  2355.     bpl.b    P61_funkend
  2356.     clr.b    P61_Funkoff(a5)
  2357.  
  2358.     move.l    P61_Sample(a5),a1
  2359.     move.l    P61_RepeatOffset(a1),d1
  2360.     move    P61_RepeatLength(a1),d0
  2361.     add.l    d0,d0
  2362.     add.l    d1,d0
  2363.     move.l    P61_Wave(a5),a0
  2364.     addq.l    #1,a0
  2365.     cmp.l    d0,a0
  2366.     blo.b    P61_funkok
  2367.     move.l    d1,a0
  2368. P61_funkok
  2369.     move.l    a0,P61_Wave(a5)
  2370.     not.b    (a0)
  2371. P61_funkend
  2372.     rts
  2373.  
  2374. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2375.     endc
  2376.  
  2377. P61_jtab
  2378.     dr    P61_fxdone
  2379.     dr    P61_fxdone
  2380.     dr    P61_fxdone
  2381.  
  2382.     ifne    P61_tp
  2383.     dr    P61_settoneport
  2384.     else
  2385.     dr    P61_fxdone
  2386.     endc
  2387.  
  2388.     ifne    P61_vib
  2389.     dr    P61_vibrato
  2390.     else
  2391.     dr    P61_fxdone
  2392.     endc
  2393.  
  2394.     ifne    P61_tpvs
  2395.     dr    P61_toponochange
  2396.     else
  2397.     dr    P61_fxdone
  2398.     endc
  2399.  
  2400.     dr    P61_fxdone
  2401.  
  2402.     ifne    P61_tre
  2403.     dr    P61_settremo
  2404.     else
  2405.     dr    P61_fxdone
  2406.     endc
  2407.  
  2408.     dr    P61_fxdone
  2409.  
  2410.     ifne    P61_sof
  2411.     dr    P61_sampleoffse
  2412.     else
  2413.     dr    P61_fxdone
  2414.     endc
  2415.     dr    P61_fxdone
  2416.  
  2417.     ifne    P61_pj
  2418.     dr    P61_posjmp
  2419.     else
  2420.     dr    P61_fxdone
  2421.     endc
  2422.  
  2423.     ifne    P61_vl
  2424.     dr    P61_volum
  2425.     else
  2426.     dr    P61_fxdone
  2427.     endc
  2428.  
  2429.     ifne    P61_pb
  2430.     dr    P61_pattbreak
  2431.     else
  2432.     dr    P61_fxdone
  2433.     endc
  2434.  
  2435.     ifne    P61_ec
  2436.     dr    P61_ecommands
  2437.     else
  2438.     dr    P61_fxdone
  2439.     endc
  2440.     
  2441.     ifne    P61_sd
  2442.     dr    P61_cspeed
  2443.     else
  2444.     dr    P61_fxdone
  2445.     endc
  2446.  
  2447.  
  2448. P61_dmason
  2449.     ifeq    system
  2450.     tst.b    $bfdd00
  2451.     move    #$2000,$dff09c
  2452.     move.b    #$19,$bfdf00
  2453.     move.l    a0,-(sp)
  2454.     move.l    P61_vektori(pc),a0
  2455.     move.l    P61_intaddr(pc),(a0)
  2456.     move.l    (sp)+,a0
  2457.     move    P61_dma(pc),$dff096
  2458.     nop
  2459.     rte
  2460.  
  2461.     else
  2462.  
  2463.     move    P61_dma(pc),$96(a6)
  2464.     lea    P61_server(pc),a3
  2465.     addq    #1,(a3)
  2466.     move.l    P61_craddr(pc),a0
  2467.     move.b    #$19,(a0)
  2468.     bra    P61_ohi
  2469.     endc
  2470.  
  2471.  
  2472. P61_setrepeat
  2473.     ifeq    system
  2474.     tst.b    $bfdd00
  2475.     movem.l    a0/a1,-(sp)
  2476.     lea    $dff0a0,a1
  2477.     move    #$2000,-4(a1)
  2478.     else
  2479.     lea    $a0(a6),a1
  2480.     endc
  2481.  
  2482.     move.l    P61_Sample+P61_temp0(pc),a0
  2483.     addq.l    #6,a0
  2484.     move.l    (a0)+,(a1)+
  2485.     move    (a0),(a1)
  2486.  
  2487.     ifgt    channels-1
  2488.     move.l    P61_Sample+P61_temp1(pc),a0
  2489.     addq.l    #6,a0
  2490.     move.l    (a0)+,12(a1)
  2491.     move    (a0),16(a1)
  2492.     endc
  2493.     
  2494.     ifgt    channels-2
  2495.     move.l    P61_Sample+P61_temp2(pc),a0
  2496.     addq.l    #6,a0
  2497.     move.l    (a0)+,28(a1)
  2498.     move    (a0),32(a1)
  2499.     endc
  2500.  
  2501.     ifgt    channels-3
  2502.     move.l    P61_Sample+P61_temp3(pc),a0
  2503.     addq.l    #6,a0
  2504.     move.l    (a0)+,44(a1)
  2505.     move    (a0),48(a1)
  2506.     endc
  2507.  
  2508.     ifne    system
  2509.     ifne    CIA
  2510.     lea    P61_server(pc),a3
  2511.     clr    (a3)
  2512.     move.l    P61_craddr+4(pc),a0
  2513.     move.b    P61_tlo(pc),(a0)
  2514.     move.b    P61_thi(pc),$100(a0)
  2515.     endc
  2516.     bra    P61_ohi
  2517.     endc
  2518.  
  2519.     ifeq    system
  2520.     ifne    CIA
  2521.     move.l    P61_vektori(pc),a0
  2522.     move.l    P61_tintti(pc),(a0)
  2523.     endc
  2524.     movem.l    (sp)+,a0/a1
  2525.     nop
  2526.     rte
  2527.     endc
  2528.  
  2529. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2530.         dc    1
  2531.  
  2532. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2533.         dc    2
  2534.  
  2535. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2536.         dc    4
  2537.  
  2538. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2539.         dc    8
  2540.  
  2541. P61_cn        dc    0
  2542. P61_dma        dc    $8200
  2543. P61_rowpos    dc    0
  2544. P61_slen    dc    0
  2545. P61_speed    dc    0
  2546. P61_speed2    dc    0
  2547. P61_speedis1    dc    0
  2548. P61_spos    dc.l    0
  2549.  
  2550.     ifeq    system
  2551. P61_vektori    dc.l    0
  2552. P61_oldlev6    dc.l    0
  2553.     endc
  2554.  
  2555. P61_ofilter    dc    0
  2556. P61_Timers    dc.l    0
  2557.  
  2558.     ifne    CIA
  2559. P61_tintti    dc.l    0
  2560. P61_thi        dc.b    0
  2561. P61_tlo        dc.b    0
  2562. P61_thi2    dc.b    0
  2563. P61_tlo2    dc.b    0
  2564. P61_timer    dc.l    0
  2565.     endc
  2566.  
  2567.     ifne    P61_pl
  2568. P61_plcount    dc    0
  2569. P61_plflag    dc    0
  2570. P61_plreset    dc    0
  2571. P61_plrowpos    dc    0
  2572. P61_looppos    dcb.b    12*channels
  2573.     endc
  2574.  
  2575.     ifne    P61_pde
  2576. P61_pdelay    dc    0
  2577. P61_pdflag    dc    0
  2578.     endc
  2579.  
  2580. P61_Samples    dcb.b    16*31
  2581. P61_positionbase dc.l    0
  2582. P61_possibase    dc.l    0
  2583. P61_patternbase    dc.l    0
  2584. P61_intaddr    dc.l    0
  2585.  
  2586.     ifne    system
  2587. P61_server    dc    0
  2588. P61_miscbase    dc.l    0
  2589. P61_audioopen    dc.b    0
  2590. P61_sigbit    dc.b    -1
  2591. P61_ciares    dc.l    0
  2592. P61_craddr    dc.l    0,0,0
  2593. P61_dat        dc    $f00
  2594. P61_timerinterrupt dc    0,0,0,0,127
  2595. P61_timerdata    dc.l    0,0,0
  2596.  
  2597. P61_allocport    dc.l    0,0
  2598.         dc.b    4,0
  2599.         dc.l    0
  2600.         dc.b    0,0
  2601.         dc.l    0
  2602. P61_reqlist    dc.l    0,0,0
  2603.         dc.b    5,0
  2604. P61_allocreq    dc.l    0,0
  2605.         dc    127
  2606.         dc.l    0
  2607. P61_portti    dc.l    0
  2608.         dc    68
  2609.         dc.l    0,0,0
  2610.         dc    0
  2611. P61_reqdata    dc.l    0
  2612.         dc.l    1,0,0,0,0,0,0
  2613.         dc    0
  2614. P61_audiodev    dc.b    'audio.device',0
  2615.  
  2616. P61_cianame    dc.b    'ciab.resource',0
  2617. P61_timeropen    dc.b    0
  2618. P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2619.     endc
  2620. P61_etu
  2621.  
  2622.     endb    a3
  2623.  
  2624.  
  2625. ******** END OF BINARY FILE **************
  2626.  
  2627.     section    chip,data_c
  2628. P61_data    incbin    "ram:P61.infected eyes"
  2629.  
  2630.     section    smp,bss_c
  2631. samples    ;ds.b    $10000        ;uncomment if you have packed samples
  2632.                 ;and insert sample buffer length
  2633.